#!/usr/bin/env python
import sys
import backport

test_package = 'mypackage.tests'  # <- Package containing tests.

config = backport.get_config('backport.ini')

if sys.version_info[0] == 3:
    start_dir = config.get('src_package_dir', test_package)
else:
    start_dir = config.get('dst_package_dir', test_package)

    # Redirect import of packages.
    backport.redirect_import('mypackage', 'py2src_noedit')
    backport.redirect_import('mypackage.tests', 'py2src_noedit.tests')

test_suite = backport.discover_tests(start_dir)
result = backport.run_tests(test_suite)
sys.exit(not result.wasSuccessful())
